#include "../wxsitemresdata.h"
#include "wxsmessagedialog.h"
#include <wx/msgdlg.h>


namespace {
  wxsRegisterItem<wxsMessageDialog> Reg( _T( "MessageDialog" ), _T( "消息" ), wxsTTool, _T( "对话框" ), 150, false );
  WXS_ST_BEGIN( wxsMessageDialogStyles, wxT( "wxOK | wxCANCEL" ) );
  WXS_ST_CATEGORY( "wxMessageDialog" )
  WXS_ST( wxOK )
  WXS_ST( wxCANCEL )
  WXS_ST( wxYES_NO )
  WXS_ST( wxYES_DEFAULT )
  WXS_ST( wxNO_DEFAULT )
  WXS_ST( wxICON_EXCLAMATION )
  WXS_ST( wxICON_HAND )
  WXS_ST( wxICON_ERROR )
  WXS_ST( wxICON_QUESTION )
  WXS_ST( wxICON_INFORMATION )
  if( ( wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_WINDOWS ) > 0 ) {
    WXS_ST( wxSTAY_ON_TOP )
  }
  WXS_ST_END()
}

wxsMessageDialog::wxsMessageDialog( wxsItemResData *Data ):
  wxsTool( Data, &Reg.Info, NULL, wxsMessageDialogStyles, ( flVariable | flId | flSubclass | flExtraCode ) ),
  m_sCaption( wxMessageBoxCaptionStr ),
  m_sMessage( wxEmptyString ) {
}

void wxsMessageDialog::OnBuildCreatingCode() {
  switch( GetLanguage() ) {
  case wxsCPP:
    AddHeader( _T( "<wx/msgdlg.h>" ), GetInfo().ClassName, 0 );
    Codef( _T( "%C(%W, %t, %t, %T, %P);\n" ), m_sMessage.wx_str(), m_sCaption.wx_str() );
    BuildSetupWindowCode();
    break;
  case wxsUnknownLanguage:
  default:
    wxsCodeMarks::Unknown( _T( "wxsMessageDialog::OnBuildCreatingCode" ), GetLanguage() );
  }
}

void wxsMessageDialog::OnEnumToolProperties( M_Code_unused long Flags ) {
  WXS_SHORT_STRING( wxsMessageDialog, m_sCaption, _T( "Caption" ), _T( "caption" ), _T( "" ), true );
  WXS_SHORT_STRING( wxsMessageDialog, m_sMessage, _T( "Message" ), _T( "message" ), wxMessageBoxCaptionStr, true );
}
